var app = getApp();
Page({
  data: {
  	type:1,
  	userCouponList:[]
  },
  onLoad(options) {
  	var $th=this;
    $th.loadlist()
  },
  settype:function(e){
  	var $th=this;
  	var i=e.currentTarget.dataset.index;
  	console.log(i);
  	$th.setData({
			type:i
		})
  	$th.loadlist()
  },
  loadlist:function(){
  	var $th=this;
  	app.globalAjax(
	  		'/api/coupon/get',
	  		"get",
	  		{status:$th.data.type},
	  		function(e){
	  			if(e.code==0)
	      	{
	      		$th.setData({
	      				userCouponList:e.userCouponList
					  })
	      	}else{
	      		wx.showToast({
				        title: e.msg,
				        icon: "none"
				      });
	      	}
	  	})
  }
})